package elmar.datastructure;

import java.util.HashMap;
import java.util.Map;

public class MarkableElement implements IMarkable {
	public final static String DEFAULT_KEY = new String("DEFAULT_KEY");
	public final static String SECONDARY_DEFAULT_KEY = new String(
			"SECONDATY_DEFAULT_KEY");
	private Map<String, Object> m_marks = new HashMap<String, Object>();

	private Object m_defautData = null;
	private Object m_secDefautData = null;

	public void clearMark() {
		m_marks.clear();
	}

	public Object getMark(String _sKey) {
		if (_sKey == null || _sKey == DEFAULT_KEY)
			return m_defautData;
		if (_sKey == SECONDARY_DEFAULT_KEY)
			return m_secDefautData;
		return m_marks.get(_sKey);
	}

	public void mark(String _sKey, Object _data) {
		if (_sKey == null || _sKey == DEFAULT_KEY)
			m_defautData = _data;
		else if (_sKey == SECONDARY_DEFAULT_KEY)
			m_secDefautData = _data;
		else
			m_marks.put(_sKey, _data);
	}

}
